this.add_constraint(new Layout.MonitorConstraint({primary: true}));
- const clickAction = new Clutter.ClickAction();
- clickAction.connect('clicked', () => {
- const [x, y] = clickAction.get_coords();
- const actor =
- global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
-
- if (!this._viewBox.contains(actor))
- this.popdown();
- });
- this.add_action(clickAction);
+ const clickGesture = new Clutter.ClickGesture();
+ clickGesture.connect('may-recognize', () => {
+ const coords = clickGesture.get_coords_abs();
+ const [, x, y] = this.child.transform_stage_point(coords.x, coords.y);
+ return !this._viewBox.allocation.contains(x, y);
+ });
+ clickGesture.connect('recognize', () => this.popdown());
+ this.add_action(clickGesture);
this._source = source;
this._folder = folder;
if (actor._backgroundMenu.isOpen)
return;
- const coords = longPressGesture.get_coords();
- const point = new Graphene.Point3D({x: coords.x, y: coords.y});
- const transformedPoint = actor.apply_transform_to_point(point);
- openMenu(transformedPoint.x, transformedPoint.y);
+ const {x, y} = longPressGesture.get_coords_abs();
+ openMenu(x, y);
});
actor.add_action(longPressGesture);
- const clickAction = new Clutter.ClickAction();
- clickAction.connect('clicked', action => {
- if (action.get_button() === 3) {
- let [x, y] = action.get_coords();
- openMenu(x, y);
- }
+ const clickGesture = new Clutter.ClickGesture({
+ required_button: Clutter.BUTTON_SECONDARY,
+ recognize_on_press: true,
});
- actor.add_action(clickAction);
+ clickGesture.connect('recognize', () => {
+ const {x, y} = clickGesture.get_coords_abs();
+ openMenu(x, y);
+ });
+ actor.add_action(clickGesture);
actor.connect('destroy', () => {
actor._backgroundMenu.destroy();
},
}, class NotificationMessageGroup extends St.Widget {
constructor(source) {
- const action = new Clutter.ClickAction();
+ const action = new Clutter.ClickGesture();
// A widget that covers stacked messages so that they don't receive events
const cover = new St.Widget({
});
this._unexpandButton.connect('clicked', () => this.emit('expand-toggle-requested'));
- action.connect('clicked', () => this.emit('expand-toggle-requested'));
+ action.connect('recognize', () => this.emit('expand-toggle-requested'));
this._headerBox.add_child(this._unexpandButton);
this.add_child(this._headerBox);
this._activatable = params.reactive && params.activate;
this._sensitive = true;
- this._clickAction = new Clutter.ClickAction({
+ this._clickGesture = new Clutter.ClickGesture({
enabled: this._activatable,
});
- this._clickAction.connect('clicked',
+ this._clickGesture.connect('recognize',
() => this.activate(Clutter.get_current_event()));
- this._clickAction.connect('notify::pressed', () => {
- if (this._clickAction.pressed)
+ this._clickGesture.connect('notify::pressed', () => {
+ if (this._clickGesture.pressed)
this.add_style_pseudo_class('active');
else
this.remove_style_pseudo_class('active');
});
- this.add_action(this._clickAction);
+ this.add_action(this._clickGesture);
if (!this._activatable)
this.add_style_class_name('popup-inactive-menu-item');
});
this.add_constraint(constraint);
- const action = new Clutter.ClickAction();
- action.connect('clicked', async () => {
- await this._pickColor(...action.get_coords());
+ const clickGesture = new Clutter.ClickGesture();
+ clickGesture.connect('recognize', async () => {
+ const {x, y} = clickGesture.get_coords_abs();
+
+ await this._pickColor(x, y);
this._result = this._color;
this._grabHelper.ungrab();
});
- this.add_action(action);
+ this.add_action(clickGesture);
this._recolorEffect = new RecolorEffect({
chroma: new Cogl.Color({
if (monitorIndex !== Main.layoutManager.primaryIndex)
this.add_style_class_name('external-monitor');
- const clickAction = new Clutter.ClickAction();
- clickAction.connect('clicked', action => {
+ const clickGesture = new Clutter.ClickGesture({
+ required_button: Clutter.BUTTON_PRIMARY,
+ });
+ clickGesture.connect('recognize', () => {
// Switch to the workspace when not the active one, leave the
// overview otherwise.
- if (action.get_button() === 1 || action.get_button() === 0) {
- const leaveOverview = this._shouldLeaveOverview();
+ const leaveOverview = this._shouldLeaveOverview();
- this.metaWorkspace?.activate(global.get_current_time());
- if (leaveOverview)
- Main.overview.hide();
- }
+ this.metaWorkspace?.activate(global.get_current_time());
+ if (leaveOverview)
+ Main.overview.hide();
});
- this.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
- this._container.add_action(clickAction);
+ this.bind_property('mapped', clickGesture, 'enabled', GObject.BindingFlags.SYNC_CREATE);
+ this._container.add_action(clickGesture);
this.connect('style-changed', this._onStyleChanged.bind(this));
this.connect('destroy', this._onDestroy.bind(this));
this);
this.inDrag = false;
- const clickAction = new Clutter.ClickAction();
- clickAction.connect('clicked',
+ const clickGesture = new Clutter.ClickGesture();
+ clickGesture.connect('recognize',
() => this.emit('selected', Clutter.get_current_event_time()));
- this._draggable.addClickAction(clickAction);
+ this.add_action(clickGesture);
let iter = win => {
let actor = win.get_compositor_private();
this._thumbnails = [];
- const clickAction = new Clutter.ClickAction();
- clickAction.connect('clicked', () => {
+ const clickGesture = new Clutter.ClickGesture();
+ clickGesture.connect('recognize', () => {
+ const coords = clickGesture.get_coords();
this._activateThumbnailAtPoint(
- ...clickAction.get_coords(),
+ coords.x, coords.y,
Clutter.get_current_event_time());
});
- this.add_action(clickAction);
+ this.add_action(clickGesture);
Main.overview.connectObject(
'showing', () => this._createThumbnails(),
this.queue_relayout();
}
- _activateThumbnailAtPoint(stageX, stageY, time) {
- const [r_, x] = this.transform_stage_point(stageX, stageY);
-
+ _activateThumbnailAtPoint(x, y, time) {
const thumbnail = this._thumbnails.find(t => x >= t.x && x <= t.x + t.width);
if (thumbnail)
thumbnail.activate(time);
}
static void
-_st_entry_icon_clicked_cb (ClutterClickAction *action,
- ClutterActor *actor,
- StEntry *entry)
+icon_click_gesture_recognize_cb (ClutterClickGesture *gesture,
+ StEntry *entry)
{
StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
+ ClutterActor *actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gesture));
if (!clutter_actor_get_reactive (CLUTTER_ACTOR (entry)))
return;
if (new_icon)
{
- ClutterAction *action;
+ ClutterAction *click_gesture;
*icon = g_object_ref (new_icon);
clutter_actor_set_reactive (*icon, TRUE);
clutter_actor_add_child (CLUTTER_ACTOR (entry), *icon);
- action = clutter_click_action_new ();
- clutter_actor_add_action_with_name (*icon, "entry-icon-action", action);
- g_signal_connect (action, "clicked",
- G_CALLBACK (_st_entry_icon_clicked_cb), entry);
+ click_gesture = clutter_click_gesture_new ();
+ clutter_actor_add_action_with_name (*icon, "entry-icon-click-gesture", click_gesture);
+ g_signal_connect (click_gesture, "recognize",
+ G_CALLBACK (icon_click_gesture_recognize_cb), entry);
}
clutter_actor_queue_relayout (CLUTTER_ACTOR (entry));